home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Postnews Replacement Script
- ** GRn Can Now Post News :-)
- */
- Parse arg result
- say result
- a = 1
- art = word(result,1)
- say art
- art2 = word(result,3)
- alreadyinsertedfile = "FALSE"
- org = "The Martin Hunt Fan Club"
- if open(org,"env:organization","R") then
- do
- organisation = readln(org)
- call close(org)
- end
-
- if open(org,"env:user","R") then
- do
- user = readln(org)
- call close(org)
- end
- if open(hos,"env:host","R") then
- do
- host = readln(hos)
- call close(hos)
- end
- if open(rln,"env:realname","R") then
- do
- realname = readln(rln)
- call close(rln)
- end
-
- if art2 = "" then
- do
- call open(file,art,"A")
- call seek(file,0,"B")
- a = 1
- newsgroup = readln(file)
- line.1 = newsgroup
- a = 3
- line.3 = "Organization: "||organisation
- line.2 = "From: "||user||"@"||host||" ("||realname||")"
- do until eof(file)
- a = a + 1
- line.a = readln(file)
- if compress(line.a) == "--" then
- do
- call signature()
- lev = 1
- end
- if lev = 1 then leave
- end
- call close(file)
- call open(file,art,"W")
- call seek(file,0,"B")
- do i = 1 to a
- call writeln(file,line.i)
- end
- call close(file)
- end
- if art2 ~="" then
- do
- call open(file,art,"A")
- call seek(file,0,"B")
- newsgroup = readln(file)
- line.1 = newsgroup
- a = 2
- sig = 0
- do while ~eof(file) & ~Sig
- a = a + 1
- if alreadyinsertedfile == "FALSE" then call insertfile2()
- line.a = readln(file)
- say line.a
- if compress(line.a) == "--" then call signature()
- if upper(word(line.a,1)) == "FROM:" then a = a - 1
- end
- call close(file)
- n = 1
- quitflag = 0
- do until quitflag
- filename = "t:grn-file."||n
- if ~exists(filename) then quitflag = 1
- n = n + 1
- end
- art = filename
- call open(file,art,"W")
- call seek(file,0,"B")
- line.2 = "Organization: "||organisation
- line.3 = "From: "||user||"@"||host||" ("||realname||")"
- do i = 1 to a
- call writeln(file,line.i)
- end
- call close(file)
- end
-
- newsno = 0
- result1 = open(batchnews,"uuspool:newsno","A")
- if ~result1 then result2 = open(batchnews,"uuspool:newsno","W")
- call seek(batchnews,0,"B")
- if result1 then newsno=readln(batchnews)
- newsno = newsno + 1
- call seek(batchnews,0,"B")
- call writeln(batchnews,newsno)
- call close(batchnews)
-
- newnewsfile = "uuspool:news."||newsno
- copycmd = "copy "||art||" to "||newnewsfile
- address command copycmd
- result1 = open(batchnews,"uuspool:newsout","A")
- if ~result1 then open(batchnews,"uuspool:newsout","W")
- call seek(batchnews,0,"E")
- call writeln(batchnews,newnewsfile)
- call close(batchnews)
-
- exit
-
- insertfile2:
- call open(file2,art2,"R")
- do while ~eof(file2)
- a = a + 1
- line.a = readln(file2)
- if word(line.a,1) == "X-NewsSoftware:" then line.a = "X-NewsSoftware: GRn 2.1 19/2/94 (PostNews Fix 31/3/95 Martin Hunt)"
- end
- alreadyinsertedfile = "TRUE"
- call close(file2)
- RETURN
-
- Signature:
- parse var newsgroup title ": " name.1 "." name.2 "." name.3 "." name.4 "." name.5 "." name.6 "." name.7 "." name.8 "." name.9 "." name.10
- nameno = 1
- sigfile = "uunews:"
- do while name.nameno ~== ""
- sigfile = sigfile || name.nameno ||"/"
- nameno = nameno + 1
- end
- sigfile = sigfile ||".sig"
- if open(sig,sigfile,"R") then
- do
- do until eof(sig)
- a = a + 1
- line.a = readln(sig)
- end
- call close(sig)
- sig = 1
- end
- return
-